

#include <sys/types.h>
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <limits.h>
#else
#include <machine/limits.h>
#endif

#if defined(__ARM_EABI__) && !defined(lint)
#define	ARM_EABI_ALIAS(alias,sym)	__strong_alias(alias,sym);
#else
#define	ARM_EABI_ALIAS(alias,sym)	/* nothing */
#endif

/*
 * Depending on the desired operation, we view a `long long' (aka quad_t) in
 * one or more of the following formats.
 */
union uu {
	quad_t	q;		/* as a (signed) quad */
	u_quad_t uq;		/* as an unsigned quad */
	int	sl[2];		/* as two signed ints */
	u_int	ul[2];		/* as two unsigned ints */
};

/*
 * Define high and low parts of a quad_t.
 */
#define	H		_QUAD_HIGHWORD
#define	L		_QUAD_LOWWORD

/*
 * Total number of bits in a quad_t and in the pieces that make it up.
 * These are used for shifting, and also below for halfword extraction
 * and assembly.
 */
#define	QUAD_BITS	(sizeof(quad_t) * CHAR_BIT)
#define	INT_BITS	(sizeof(int) * CHAR_BIT)
#define	HALF_BITS	(sizeof(int) * CHAR_BIT / 2)

/*
 * Extract high and low shortwords from longword, and move low shortword of
 * longword to upper half of long, i.e., produce the upper longword of
 * ((quad_t)(x) << (number_of_bits_in_int/2)).  (`x' must actually be u_int.)
 *
 * These are used in the multiply code, to split a longword into upper
 * and lower halves, and to reassemble a product as a quad_t, shifted left
 * (sizeof(int)*CHAR_BIT/2).
 */
#define	HHALF(x)	((u_int)(x) >> HALF_BITS)
#define	LHALF(x)	((u_int)(x) & (((int)1 << (u_int)HALF_BITS) - 1))
#define	LHUP(x)		((u_int)(x) << (u_int)HALF_BITS)

/*
 * XXX
 * Compensate for gcc 1 vs gcc 2.  Gcc 1 defines ?sh?di3's second argument
 * as u_quad_t, while gcc 2 correctly uses int.  Unfortunately, we still use
 * both compilers.
 */
#if __GNUC_PREREQ__(2, 0) || defined(lint)
typedef unsigned int	qshift_t;
#else
typedef u_quad_t	qshift_t;
#endif

__BEGIN_DECLS
quad_t __adddi3(quad_t, quad_t);
quad_t __anddi3(quad_t, quad_t);
quad_t __ashldi3(quad_t, qshift_t);
quad_t __ashrdi3(quad_t, qshift_t);
int __cmpdi2(quad_t, quad_t);
quad_t __divdi3(quad_t, quad_t);
quad_t __fixtfdi(long double);
quad_t __fixdfdi(double);
quad_t __fixsfdi(float);
u_quad_t __fixunstfdi(long double);
u_quad_t __fixunsdfdi(double);
u_quad_t __fixunssfdi(float);
long double __floatditf(quad_t);
double __floatdidf(quad_t);
float __floatdisf(quad_t);
long double __floatunditf(u_quad_t);
double __floatundidf(u_quad_t);
float __floatundisf(u_quad_t);
quad_t __iordi3(quad_t, quad_t);
quad_t __lshldi3(quad_t, qshift_t);
quad_t __lshrdi3(quad_t, qshift_t);
quad_t __moddi3(quad_t, quad_t);
quad_t __muldi3(quad_t, quad_t);
quad_t __negdi2(quad_t);
quad_t __one_cmpldi2(quad_t);
u_quad_t __qdivrem(u_quad_t, u_quad_t, u_quad_t *);
quad_t __subdi3(quad_t, quad_t);
int __ucmpdi2(u_quad_t, u_quad_t);
u_quad_t __udivdi3(u_quad_t, u_quad_t );
u_quad_t __umoddi3(u_quad_t, u_quad_t );
quad_t __xordi3(quad_t, quad_t);
__END_DECLS
